package com.androidx.p013lv.mine.activity;

import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.base.utils.ToastUtils;
import com.androidx.p013lv.mine.C1207R;
import com.androidx.p013lv.mine.bean.ProxyBean;
import com.androidx.p013lv.mine.databinding.ActivityProxyLayoutBinding;
import com.androidx.p013lv.mine.model.ProxyViewModel;
import com.gyf.immersionbar.ImmersionBar;

/* renamed from: com.androidx.lv.mine.activity.ProxyActivity */
public class ProxyActivity extends BaseActivity<ActivityProxyLayoutBinding> {
    private ProxyViewModel model;

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivityProxyLayoutBinding) this.binding).toolbar).init();
    }

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return C1207R.C1212layout.activity_proxy_layout;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        this.model = (ProxyViewModel) new ViewModelProvider(this).get(ProxyViewModel.class);
        ((ActivityProxyLayoutBinding) this.binding).setClick(new OnClick());
        this.model.dataProxy(this).observe(this, new Observer<BaseRes<ProxyBean>>() {
            /* class com.androidx.p013lv.mine.activity.ProxyActivity.C12611 */

            public void onChanged(BaseRes<ProxyBean> baseRes) {
                if (baseRes.getCode() == 200) {
                    ProxyBean data = baseRes.getData();
                    if (data != null) {
                        ((ActivityProxyLayoutBinding) ProxyActivity.this.binding).setProxy(data);
                        return;
                    }
                    return;
                }
                ToastUtils.getInstance().showSigh(baseRes.getMsg());
            }
        });
    }

    /* renamed from: com.androidx.lv.mine.activity.ProxyActivity$OnClick */
    public class OnClick {
        public void toPromote() {
        }

        public OnClick() {
        }

        public void btnBack() {
            ProxyActivity.this.finish();
        }

        public void proxyRules() {
            if (!ProxyActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.PROXY_RULE_ACTIVITY).navigation();
            }
        }

        public void performanceDetails() {
            if (!ProxyActivity.this.isOnClick()) {
                ARouter.getInstance().build(Constance.PROXY_DETAILS_ACTIVITY).navigation();
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onDestroy() {
        ProxyViewModel proxyViewModel = this.model;
        if (proxyViewModel != null) {
            proxyViewModel.cancelHttp();
        }
        super.onDestroy();
    }
}
